package Messages;

public class EntrantDetected extends Alert {
	
	public static final String TIMESTAMP = new String("timestamp");
	public static final String CAMERA_IP_ADDR = new String("cameraIPAdress");
	public static final String CAMERA_ACCESS_PORT = new String("cameraAccessPort");
	public static final String QUEUE_NAME = new String("queueName");
	
	public EntrantDetected(String cameraIPAddress, String cameraAccessPort, String queueName)
	{
		m_context = "entrantDetected";
		m_renderOrder = new String[]{TIMESTAMP,CAMERA_IP_ADDR,CAMERA_ACCESS_PORT,QUEUE_NAME};
		this.m_varList.put(TIMESTAMP, "0");
		this.m_varList.put(CAMERA_IP_ADDR, cameraIPAddress);
		this.m_varList.put(CAMERA_ACCESS_PORT, cameraAccessPort);
		this.m_varList.put(QUEUE_NAME, queueName);
	}
	
	public EntrantDetected(String messageVarList) throws InvalidVarListException
	{
		m_context = "entrantDetected";
		m_renderOrder = new String[]{TIMESTAMP,CAMERA_IP_ADDR,CAMERA_ACCESS_PORT,QUEUE_NAME};
		this.PutStringInVarList(messageVarList);
	}
	
	public String GetTimestamp()
	{
		return this.m_varList.get(0);
	}
	
	@Override
	public String RenderMessage()
	{
		String timestamp = new Long(System.currentTimeMillis() / 1000).toString();
		this.m_varList.put(TIMESTAMP, timestamp);
		return super.RenderMessage();
	}
}
